import { mount } from '@vue/test-utils'
import { describe, test, expect } from 'vitest'
import TestHelloWorldVue from '../../src/components/TestHelloWorld.vue'

describe('TestHelloWorld页面的功能测试', () => {
    test('mount component', async () => {
        expect(TestHelloWorldVue).toBeTruthy()

        const wrapper = mount(TestHelloWorldVue, {
            props: {
                count: 4,
            },
        })

        expect(wrapper.text()).toContain('4 x 2 = 8')

        expect(wrapper.html()).toMatchSnapshot()
        await wrapper.get('button').trigger('click')
        expect(wrapper.text()).toContain('4 x 3 = 12')
        await wrapper.get('button').trigger('click')
        expect(wrapper.text()).toContain('4 x 4 = 16')
    })
})
